<template>
  <div>
    <li v-for="(item,index) in arr " :key="index">
      {{item}}
      <button @click="btn">删除</button>
    </li>

  <button @click="btnAdd">生成</button>
  </div>
</template>

<script>
export default {
  data () {
    return {
      arr: [1, 5, 3]

    }
  },

  created () {

  },

  methods: {
    btn () {
      // js删除数组中某一条数据
      this.arr.splice(this.index, 1)
    },
    btnAdd () {
      this.arr.push(Math.floor(Math.random() * 10 + 1))
    }

  }
}
</script>

<style scoped lang='less'>

</style>
